package com.wigball.java.jchef.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public final class StringNormalizer {

	private StringNormalizer() {

	}

	public static String normalize(String s) {
		return s != null ? s.trim() : null;
	}

	public static List<String> normalize(List<String> strings) {
		if (strings == null) {
			return null;
		}

		List<String> result = new ArrayList<String>();

		for (String s : strings) {
			String normalized = normalize(s);
			if (normalized != null && !"".equals(normalized)) {
				result.add(normalized);
			}
		}

		return result;
	}

	public static List<String> normalize(String[] strings) {
		return strings != null ? normalize(Arrays.asList(strings)) : null;
	}
}
